package kr.ac.postech.marathon.client.widgets;

import kr.ac.postech.marathon.client.HasModel;
import kr.ac.postech.marathon.client.models.IdNumber;

import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.TextBox;

public class IdNumberForm extends Composite implements HasModel<IdNumber> {
	
	private TextBox firstGroup;
	private TextBox secondGroup;
	
	private HorizontalPanel hPanel;
	
	public IdNumberForm() {
		firstGroup = new TextBox();
		secondGroup = new TextBox();
		hPanel = new HorizontalPanel();
		
		firstGroup.setMaxLength(6);
		firstGroup.setVisibleLength(6);
		secondGroup.setMaxLength(7);
		secondGroup.setVisibleLength(7);
		
		hPanel.add(firstGroup);
		hPanel.add(new HTML("-"));
		hPanel.add(secondGroup);
		
		initWidget(hPanel);
	}
	

	public IdNumber getModel() {
		// TODO Auto-generated method stub
		return new IdNumber(firstGroup.getText(), secondGroup.getText());
	}
}